import os
from langchain_openai import ChatOpenAI
from langchain.schema import (
    HumanMessage,
    SystemMessage
)


# 从环境变量中获取API密钥和模型名称
api_key = "34a3cc1f-3608-4c2e-8cbe-6f2076c30126"
model = "ep-20240606130022-nrz5h"

# 初始化ChatOpenAI对象
llm = ChatOpenAI(openai_api_key=api_key,
                 openai_api_base="https://ark.cn-beijing.volces.com/api/v3",
                 model=model,
                 temperature=0.8,
                 max_tokens=60)

messages = [
    SystemMessage(content="你是一个很棒的智能助手"),
    HumanMessage(content="请给我的花店起个名")
]
response = llm.invoke(messages)

print(response.content)



